﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Configuration;
/* 配置读取类 */
namespace DataProcessModule
{
    public static class ConfigrationSettingsReader
    {
        public static string SqlConnectAddress = ConfigurationManager.AppSettings["SqlConnectAddress"];

        public static string TcpServerPort_1 = ConfigurationManager.AppSettings["TcpServerPort_1"];

        public static string WriteLocalLog = ConfigurationManager.AppSettings["WriteLocalLog"];

        public static string TcpServerPort_2 = ConfigurationManager.AppSettings["TcpServerPort_2"];

        public static string UpgradeSendFreq = ConfigurationManager.AppSettings["UpgradeSendFrequency"];

        public static Int64 AtUpgradeSendFreq 
        {
            get 
            {
                try 
                {
                    return Convert.ToInt64(ConfigurationManager.AppSettings["UpgradeSendFrequency"]);
                }
                catch (Exception e) 
                {
                    return 3600000;
                }
            }
        }

        public static UInt16 AtTcpServerPort_1
        {
            get
            {
                try
                {
                    return Convert.ToUInt16(ConfigurationManager.AppSettings["TcpServerPort_1"]);
                }
                catch (Exception e)
                {
                    return 7086;
                }
            }
        }

        public static UInt16 AtTcpServerPort_2
        {
            get
            {
                try
                {
                    return Convert.ToUInt16(ConfigurationManager.AppSettings["TcpServerPort_2"]);
                }
                catch (Exception e)
                {
                    return 7087;
                }
            }
        }
    }
}
